home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #2 / Monster Media No. 2 (Monster Media)(1994).ISO / prog_c / dbpp20.zip / DBPPARAY.HPP < prev    next >
Text File  |  1994-05-09  |  1KB  |  45 lines

  1. /*
  2.    Library: DataBase++ Ver. 2.00.
  3.    File:    DBPPARAY.HPP
  4.    
  5.    Purpose: Declarations for class DBArray. DBArray is an array class that
  6.             holds pointers to DBObject types. It is much smaller than
  7.             the Borland equivalent BI_IArrayAsVector types. This array can be
  8.             converted easily to use templates if your compiler supports them.
  9.    
  10.    Notice:  Copyright (C), 1992 - 1994, Jeff Stapleton. All rights reserved.
  11. */   
  12.  
  13. #ifndef _DBPPARAY_HPP
  14. #define _DBPPARAY_HPP
  15.  
  16. #include <dbppobjt.hpp>
  17.  
  18. class DBArray : public DBObject
  19. {
  20.    public:
  21.  
  22.       DBArray( int sz = 1, int growBy = 1 );
  23.       virtual ~DBArray();
  24.  
  25.       void           add( DBObject *anObject );
  26.       int            itemsInArray() { return numItems; }
  27.       void           ownsObjects( unsigned bool ) { shouldDelete = bool; }
  28.       void           remove( int index );
  29.       void           remove( DBObject *anObject );
  30.       DBObject *    operator [] ( int index );
  31.       
  32.    private:
  33.  
  34.       DBObject **   theArray;
  35.       int            size;
  36.       int            numItems;
  37.       int            delta;
  38.       int            shouldDelete;
  39.  
  40.       void           grow();
  41. };
  42.  
  43. #endif // _DBPPARAY_HPP
  44.  
  45.